﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace TagBasedResourceManagePlatform.Misc
{
    public class Misc
    {
        public static string StandardizeTags(string[] tags)
        {
            StringBuilder sb = new StringBuilder();
            foreach(string tag in tags)
            {
                //TODO: More strict replace shuold be taken here by using Regex.
                var tagFixed = tag.Replace(",", "").Replace(" ", "");

                sb.Append(tagFixed);
                sb.Append(",");
            }

            return sb.ToString(0, sb.Length - 1);
        }

        public static string StandardizeTags(string tags)
        {
            return StandardizeTags(tags.Split(new char[] { ',', ' ', '，', '/', '\\' }, StringSplitOptions.RemoveEmptyEntries));
        }


    }
}
